package com.example.demo.service.impl;

import com.example.demo.mapper.HeroMapper;
import com.example.demo.model.Hero;
import com.example.demo.service.HeroService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author Hae
 * @Date 2019/9/12 10:39
 * @Version 1.0
 */
@Service
public class HeroServiceImpl implements HeroService {

    @Autowired
    private HeroMapper heroMapper;

//    @Autowired
//    private StringRedisTemplate stringRedisTemplate;

    @Override
    public List<Hero> getAllHeros() {
        return heroMapper.getAllHeros();
    }

    @Override
    public Hero getHeroById(int id) {
        return heroMapper.getHeroById(id);
    }

    @Override
    public int addHero(Hero hero) {
        return heroMapper.addHero(hero);
    }

    @Override
    public int updateHero(Hero hero) {
        return heroMapper.updateHero(hero);
    }

    @Override
    public int deleteHero(int id) {
        return heroMapper.deleteHero(id);
    }

    @Override
    public List<Hero> getHeroByName(String name) {
        return heroMapper.getHeroByName(name);
    }
}
